/**
  ETFAna project, Anyang Normal University && IMP-CAS
  \class ETFTimer2
  \brief a bothly-ended plastic scintillator
  \author SUN Yazhou, asia.rabbit@163.com
  \since 2021-10-30
  \date 2021-10-30 last modified
  \attention
  changelog
  <table>
  <tr>  <th>Date         <th>Author      <th>Description                   </tr>
  <tr>  <td>2021-10-30   <td>Asia Sun    <td>file created                  </tr>
  </table>

  \copyright Copyright (c) 2021-2024 Anyang Normal U. && IMP-CAS with LGPLv3 LICENSE
*/

#ifndef ETFTimer2_h
#define ETFTimer2_h

#include "ETFTimer.h"

class ETFHPTDCCh;
class ETFPlaHit;

class ETFTimer2 : public ETFTimer{
public:
  ETFTimer2(){}
  ETFTimer2(const char *name, double length = 50.);
  virtual ~ETFTimer2(){}

  virtual void Assign(const ETFRawChannel *ch, unsigned uid) override; ///< add the data channel to the detector
  virtual void Initialize() override; ///< initialize the detector

  virtual double GetTime() const override; ///< extract the timing data of the detector
  virtual double GetTimeL() const; ///< time of the left hand PMT
  virtual double GetTimeR() const; ///< time of the right hand PMT
  virtual double timeL() const{ return GetTimeL(); }
  virtual double timeR() const{ return GetTimeR(); }

  using ETFDetector::GetHitPosition;
  virtual int GetFiredStatus() const override; ///< \retval fHits[0]->GetFiredStatus()
  virtual int GetHitPosition() const;
  virtual int hitPos() const{ return GetHitPosition(); }
  virtual void ConstructGraph() override; ///< add strip to fGDumb
  virtual void DrawHits() override; ///< draw the hits
  virtual void PostAssign() override;

  // ClassDefOverride(ETFTimer2, 0);

protected:
  ETFPlaHit *fHit; //-> ///< just for convenience

  /// \param stripId: 0-30, along x increasing direction
  /// \param vh: 0-1: v, h
  virtual void AddHit(const ETFRawChannel *ch, int udvh);
};

#endif
